const app = getApp()
const url = app.globalData.url
const url1 = app.globalData.url1
const util = require("../../utils/comm.js");
const datautil1 = require("../../utils/data.js");
const datautil2 = require("../../utils/util.js");
var userTel = ""
var pid = "" //一级菜单id
var menuid = "" //二级菜单id
var data1 = "" //日期
var data2 = "" //时间
var menuType=""
var kstatus = 0 //单子类型0 快速 1预约
var address = {}
var equipmentId = ''
var guzhang = ""
var engineer = {}
var SysInfo = {}
var ordername = ""
var date = ""
var guzhangId = ""
var more = false
var beizhu = ''
var smenuid = ''
var brandId=''
var eqBrand = '' // 品牌
var eqType = "" //类型
var eqModel = "64G" //型号
var eqColor = "#FFF"
var orderAmount=0 //总价
var engineerRank=''//维修师等级
Page({

  /**
   * 页面的初始数据
   */
  data: {
    percent: [{ addr: "地址", icon: '../image/icon01.png' }, { addr: "设备", icon: '../image/icon02.png' }, { addr: "故障", icon: '../image/icon03.png' }, { addr: "师傅", icon: '../image/icon04.png' } ],
    sblist: [],
    in: 0,
    inde: 0,
    neicunindex: 0,
    colorIndex: 0,
    guzs: [],
    showModalStatus: false,
    baoxiuIndex: 0,
    dxStatus: false,
    timeStatus: true,
    xdStatus: true,
    ygStatus: true,
    addSbStatus: true,
    types: [],
    brans: [],
    address: {},
    names: "下单",
    flag: true,
    hours: [{time:"上午",timeframe:"8:00~11:00"}, {time:"中午",timeframe:"11:00~14:00"}, {time:"下午",timeframe:"14:00~17:00"}, {time:"晚上",timeframe:"17:00~20:00"}],
    datas: [],
    kstatus: 1,
    ttIndex: 0,
    tempFilePaths:[],
    length: 0,
    selectsEng: "选择维修师",
    addIndex1: 0,
    addIndex: 0,
    addIndex2: 0,
    kuaisu: 1,
    isTrue: true,
    mores: '../image/low.png',
    coupons:[1,2,2,2,2],
    couponsPrice:0,
    prices:0,
    hideText:true
  },


  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function(options) {
    console.log(options)
    const that = this
    var user = wx.getStorageSync("user")
    userTel = user.wxUsersAccount
    that.setData({
      userImg: user.wxUsersAvatarUrl,
      menuName: options.ordername
    })
    console.log(options)
    menuid=options.menuId
    menuType=options.menutype
    that.getShebeiList(options.menuId, options.menutype)
    pid = options.pid
    ordername = options.ordername
    that.getGuzhangIntroduce()
    that.getpictures()
    that.geguzhang(menuid, pid) 
  },

  getpictures(){
    const that = this
    wx.request({
      url: url + '/menu/menus_icon',
      data: {
       mid:menuid
      },
      header: {
        "content-type": "application/json"
      },
      success(res) {
         console.log("查询图片")
        console.log(res)
        if (res.data.code == 1) {
          that.setData({
            imgs: res.data.data.icon
          })
        }
      }

    })
  },
  getusebleCoupon(){
    const that = this
    wx.request({
      url: url + '/coupon/usr/list_coupon',
      data: {
        account: userTel
      },
      header: {
        "content-type": "application/json"
      },
      success(res) {

        console.log(res)
        if (res.data.code == 1) {
          that.setData({
            useblecoupon: res.data.data.couponUsrList
          })
        }
      }

    })
  },
  kuaisu(){
    this.setData({
      kstatus:1,
      kuaisu:1
    })
    wx.removeStorageSync("engneer")
    wx.removeStorageSync("time")
  },
  // 获取系统信息
  getSystemInfo: function() {
    const that = this
    wx.getSystemInfo({
      success: function(res) {
        console.log(res)
        SysInfo = {
          eqModel: res.model,
          eqBrand: res.brand
        }
        console.log(that.data.sblist)
      }
    })
  },
  // 上传图片

  getpicture: function() {
    var that = this;
    wx.showActionSheet({
      itemList: ['从相册中选择', '拍照'],
      itemColor: "#CED63A",
      success: function(res) {
        if (!res.cancel) {
          if (res.tapIndex == 0) {
            that.chooseWxImage('album')
          } else if (res.tapIndex == 1) {
            that.chooseWxImage('camera')
          }
        }
      }
    })
  },
  chooseWxImage: function(type) {
    var that = this;
    wx.chooseImage({
      count: 4 - this.data.tempFilePaths.length,
      sizeType: ['original', 'compressed'],
      sourceType: [type],
      success: function(res) {
        console.log(res);

        //上传到自己的服务器
        var filePaths = res.tempFilePaths;
        //多张图片
        for (var index in filePaths) {
          console.log(filePaths[index]);

          wx.uploadFile({
            url: url + '/photo/add_img',
            filePath: filePaths[index],
            name: 'files',
            formData: {
              'user': 'test'
            },
            success: function(res) {

              console.log('123qwe')
              //为空赋值
              for (var i = 0; i < 4; i++) {
                if (that.data.tempFilePaths[i] == null) {
                  console.log("fileq:" + that.data.tempFilePaths[i]);
                  that.data.tempFilePaths[i] = res.data;
                  console.log("fileh:" + that.data.tempFilePaths[i]);
                  break;
                }
              }

              that.setData({

                tempFilePaths: that.data.tempFilePaths,
                length: that.data.tempFilePaths.length
              })
            }


          })

        }

      }
    })
  },
  // 选择设备
  selectEq(e) {
    console.log(e)
    const that = this
    that.setData({
      inz: e.currentTarget.dataset.index,
      shebei: e.currentTarget.dataset.name
    })
    equipmentId = e.currentTarget.id
    var typeid = e.currentTarget.dataset.type
    that.geguzhang(typeid, pid)
  },
  // 选择故障
  selectGz(e) {
    const that = this
    that.setData({
      gzindex: e.currentTarget.dataset.index,
      zuhang: e.currentTarget.dataset.name,
      inde: 2
    })

    guzhang = e.currentTarget.dataset.name
    guzhangId = e.currentTarget.dataset.id
    console.log(guzhang)
    that.getGuzhangIntroduce(e.currentTarget.dataset.id)
    that.getPrice(engineerRank,guzhangId)
  },

  getGuzhangIntroduce(mid) {
    const that = this
    wx.request({
      url: url + '/fault/explain/find',
      data: {
        faultId: mid
      },
      header: {
        "content-type": "application/json"
      },
      success(res) {
         console.log("故障说明")
        console.log(res)
        if (res.data.code == 1) {
          that.setData({
            introduce: res.data.data.faultExplain.faultExplainContent
          })
        }else{
          that.setData({
            introduce: ''
          })
        }
      }

    })
  },

  //设备类型添加设备的
  getShebeiType(data) {
    const that = this
    wx.request({
      url: url + '/menu/menus_pid',
      data: {
        pid: data
      },
      header: {
        'content-type': 'application/json'
      },
      success(res) {
        console.log("获取二级菜单：")
        console.log(res.data)

        if (res.data.code == 1) {
          smenuid = res.data.data.menus[0].menuId
          eqType = res.data.data.menus[0].menuName
          var id = data == 5 ? 5 : res.data.data.menus[0].menuId
          that.getbrans(res.data.data.menus[0].menuId,id)
          if (id!=5){
            that.setData({
              checkedimg1: res.data.data.menus[0].menuImg1
            })
          }
          that.setData({
            types: res.data.data.menus,
            eqtype:eqType,
           
          })
         
        } else {
          wx.showToast({
            title: '加载失败',
            icon: "loading",
            duration: 1000
          })
        }
      }
    })
  },
  //加载品牌类型
  getbrans(data,id) {
    console.log(id)
    const that = this
    wx.request({
      url: url + '/menu/menus_pid',
      data: {
        pid: data
      },
      header: {
        'content-type': 'application/json'
      },
      success(res) {
        console.log("获取品牌类型：")
        console.log(res.data)
       console.log(data)
        if (res.data.code == 1) {
          eqBrand = res.data.data.menus[0].menuName
          brandId=res.data.data.menus[0].menuId
          if(id==5){
            that.setData({
              brans: res.data.data.menus,
              eqbrand: eqBrand,
              checkedimg1: res.data.data.menus[0].menuImg1,
              checkedimg2:''
            })
          }else{
            that.setData({
              brans: res.data.data.menus,
              eqbrand: eqBrand,
              checkedimg2: res.data.data.menus[0].menuImg1
            })
          }
         
        } else {
          eqBrand = ''
          eqModel = ''
          that.setData({
            brans: [],
            models: [],
            isTrue: false
          })
        }
      }
    })
  },

  // 获取故障
  geguzhang(mid, pid) {
    const that = this
    wx.request({
      url: url + '/menu/fault/list_mid',
      data: {
        mid1: pid,
        mid2: mid
      },
      method: "get",
      header: {
        "content-type": "application/json"
      },
      success(res) {
        console.log("故障")
        console.log(res.data)
        if (res.data.code === 1) {
          that.setData({
            guzs: res.data.data.menuFaults
          })
        } else {

        }
      }
    })
  },
  //获取设备
  getShebeiList(menid, type) {
    console.log("获取设备列表")
    const that = this
    wx.request({
      url: url + '/Equipment/getListEquipment',
      data: {
        menuId: menid,
        account: userTel
      },
      method: "get",
      header: {
        "content-type": "application/json"
      },
      success(res) {
        console.log("查询的设备列表")
        console.log(res.data)
        if (res.data.code == 1) {
          // that.data.sblist = res.data.data.equipment
          // if (type == "手机") {
          //   that.getSystemInfo()
          //   that.data.sblist.push(SysInfo)
          // }
          that.setData({
            sblist: res.data.data.equipment
          })

        }
      }
    })
  },

  selectRank(e) {
    const that = this
    smenuid = e.currentTarget.dataset.sid
    eqType = e.currentTarget.dataset.type
    that.getbrans(e.currentTarget.dataset.sid)
    that.setData({
      addIndex: e.currentTarget.dataset.index,
      eqtype:eqType,
      checkedimg1:e.currentTarget.dataset.img
    })
  },
  selectBrand(e) {
    const that = this
    console.log("选择品牌时")
    console.log(e)
    const type=e.currentTarget.dataset.type
    brandId=e.currentTarget.dataset.id
    if(type){
      that.setData({
        checkedimg1: e.currentTarget.dataset.img
      })
    }else{
      that.setData({
        checkedimg2: e.currentTarget.dataset.img
      })
    }
    eqBrand = e.currentTarget.dataset.brand
    that.setData({
      addIndex1: e.currentTarget.dataset.index,
      eqbrand:eqBrand
     
    })
  },

  getModels(e) {
    const that = this
    eqModel = e.currentTarget.dataset.name
    that.setData({
      neicunindex: e.currentTarget.dataset.index,
      pmodel:eqModel
    })
  },
  getColor(e) {
    const that = this
    var color = e.currentTarget.dataset.name
   
    if(color=="#fff"){
      eqColor ="白色"
    }else if(color=="#000"){
      eqColor = "黑色"
    } else if (color == "#ECE2AD") {
      eqColor = "金色"
    } else if (color == "#EFB2E1") {
      eqColor = "粉色"
    }
    that.setData({
      colorIndex: e.currentTarget.dataset.index,
      pcolor:eqColor
    })
  },
  //确认添加设备
  submitAddsb() {
    const that = this

    console.log(eqBrand == null)
    if (eqBrand == '') {
      wx.showToast({
        title: '请选择品牌类型',
        icon: "loading",
        duration: 1000
      })
    } else {
      wx.request({
        url: url + '/Equipment/addEquipment',
        data: {
          wxUsersAccount: userTel,
          menuId: menuid,
          typeId: smenuid,
          eqType: eqType,
          eqBrand: eqBrand,
          eqModel: eqModel,
          eqColor: eqColor,
          brandId:brandId
        },
        method: "get",
        header: {
          "content-type": "application/json"
        },
        success(res) {
          console.log(res)
          if (res.data.code == 0) {
            wx.showToast({
              title: '添加成功',
              icon: "success",
              duration: 1000
            })
            that.popupTap1()
            that.getShebeiList(menuid,menuType)
          } else {
            wx.showToast({
              title: '添加失败',
              icon: "success",
              duration: 1000
            })
          }
        }
      })
    }
  },
  cansle() {
    const that = this
    that.hideModal()
  },

  xiadan1() {
    
    if (address.addressName.length==0){
      wx.showToast({
        title: '请选择地址',
        icon:"loading",
        duration:1000
      })
    } else if (equipmentId.length==0){
      wx.showToast({
        title: '请选择设备',
        icon: "loading",
        duration: 1000
      })
    } else{
    wx.showLoading({
      title: '正在下单',
    })
    wx.request({
      url: url1+'/orders/create',
      method: "GET",
      header: {
        "content-type": 'application/json'
      },
      data: {
        /** 订单总金额.预约单:故障费+所选维修师服务费;快速单:只需传输故障费 */
        orderAmount: 100,
        /** 订单上门时间段.快速单可不填 */
        // timeFrame:date,
        //  guzhangId:guzhang,
        /**订单类型. */
        orderType: kstatus,
        /** 经度. */
        longitude: address.addressLongitude,
        /** 纬度. */
        latitude: address.addressLatitude,
        equipmentId: equipmentId,
        /** 一级菜单id.*/
        // menu1id:menuid,
        /** 二级菜单id.*/
        menu2id: pid,
        /** 订单服务地址.*/
        addressName: address.addressName,
        addressTel: address.addressPhone,
        addressLocal: address.addressLocation +
        address.addressDoorNumber,
        beiZhu: beizhu,
        tempFile: this.data.tempFilePaths,
        /**
         * 买家标识
         */
        // @NotEmpty(message = "买家平台账号")
        usesAccount: userTel,

        /**
         * 故障名称
         */
        failure: guzhang,
        /**
         * 菜单（一级菜单+二级菜单）
         */
        menu: ordername,
        guzhangId: guzhangId
      },
      success(res) {
        wx.hideLoading()
        if (res.data.code == 1) {
          wx.removeStorageSync('time')
          wx.removeStorageSync('engneer')

          app.globalData.currentTab =4
          wx.navigateTo({
            url: '../order/order',
          })
          guzhang=''
        } else {
          wx.showToast({
            title: '服务器繁忙',
            icon: "loading",
            duration: 1000
          })
        }
      }
    })
    }
  },
  xiadan2() {
//     else if(guzhang.length == 0) {
//   wx.showToast({
//     title: '请选择故障',
//     icon: "loading",
//     duration: 1000
//   })
// }
    if (address.addressName.length == 0) {
      wx.showToast({
        title: '请选择地址',
        icon: "loading",
        duration: 1000
      })
    } else if (equipmentId.length == 0) {
      wx.showToast({
        title: '请选择设备',
        icon: "loading",
        duration: 1000
      })
    }  else if (engineer.engineerNumber.length==0){
      wx.showToast({
        title: '请选择维修师',
        icon: "loading",
        duration: 1000
      })
    }else{
    wx.showLoading({
      title: '正在下单',
    })
    wx.request({
      url: url1+'/orders/createOther',
      method: "GET",
      header: {
        "content-type": 'application/json'
      },
      data: {
        /** 订单总金额.预约单:故障费+所选维修师服务费;快速单:只需传输故障费 */
        orderAmount: 100,
        /** 订单上门时间段.快速单可不填 */
        timeFrame: date,
        //  guzhangId:guzhang,
        /**订单类型. */
        orderType: kstatus,
        /** 经度. */
        longitude: address.addressLongitude,
        /** 纬度. */
        latitude: address.addressLatitude,
        equipmentId: equipmentId,
        /** 一级菜单id.*/
        // menu1id:menuid,
        engineerNumber: engineer.engineerNumber,
        /** 二级菜单id.*/
        menu2id: pid,

        /** 订单服务地址.*/
        addressName: address.addressName,
        addressTel: address.addressPhone,
        addressLocal: address.addressLocation +
          address.addressDoorNumber,
        beiZhu: beizhu,
        tempFile: this.data.tempFilePaths,
        /**
         * 买家标识
         */
        // @NotEmpty(message = "买家平台账号")
        usesAccount: userTel,
        /**
         * 故障名称
         */
        failure: guzhang,
        /**
         * 菜单（一级菜单+二级菜单）
         */
        menu: ordername,
        guzhangId: guzhangId
      },
      success(res) {
        wx.hideLoading()
        if (res.data.code == 1) {
          wx.removeStorageSync('time')
          wx.removeStorageSync('engneer')

          app.globalData.currentTab = 4
          wx.navigateTo({
            url: '../order/order',
          })
          guzhang = ''
        } else {
          wx.showToast({
            title: '服务器繁忙',
            icon: "loading",
            duration: 1000
          })
        }
      }
    })
    }
  },
  dianji(){
    wx.showModal({
      title: 'dd',
      content: 'dd',
    })
  },
  getbeizhu(e) {
    console.log(e)
    beizhu = e.detail.value
  },
  selectEn: function() {
    console.log("选择师傅去")
    wx.navigateTo({
      url: '../enlist/enlist?menuId=' + menuid,
    })
  },
  
  addShebei:function() {
    console.log("点击")
    const that = this
    that.showPopup1()
    that.getShebeiType(menuid)
    that.setData({
      addSbStatus: false,
      equipmentShow: menuid,
      menuNames: ordername,
      pcolor:"白色",
      pmodel:"64G"
    })
  
  },
  
  selections(data) {
    console.log(data)
    const that = this
    if (data.currentTarget.dataset.index == 0) {
      that.setData({
        select: false,
        kstatus: 1,
        ttIndex: data.currentTarget.dataset.index
      })
      wx.removeStorageSync("engneer")
      wx.removeStorageSync("time")
    } else {
      that.setData({
        select: true,
        kstatus: 2,
        ttIndex: data.currentTarget.dataset.index
      })
    }

  },
  showxdStatus() {
    const that = this
    that.setData({
      xdStatus: false,
      timeStatus: true,
   
    })
    console.log(that.data.kstatus)
    if (that.data.kstatus==1){
      that.setData({
        selectsEng: ""
      })
    }
    // that.tt()
  that.showPopup()
  },
  showYgStatus() {
    const that = this
    that.setData({
      ygStatus: false,
      timeStatus: true,
      gz:guzhang
    })
    that.showPopup()
    this.getusebleCoupon()
  },
  showTimeModel() {
    var that = this
    that.setData({
      timeStatus: false
    })
    that.showPopup()
  },
  showModel() {
    var that = this
    that.setData({
      dxStatus: true
    })
    // that.tt()
    wx.navigateTo({
      url: '../repair/repair',
    })
  },

  showPopup() {
    let popupComponent = this.selectComponent('.J_Popup');
    popupComponent && popupComponent.show();
    this.setData({
      showPop:false,
      hideText:false
    })
  },
  hidePopup() {
    let popupComponent = this.selectComponent('.J_Popup');
    popupComponent && popupComponent.toggle(false);
    // popupComponent && popupComponent.hide();
    this.setData({
      showModalStatus: false,
      dxStatus: false,
      timeStatus: true,
      xdStatus: true,
      ygStatus: true,
      addSbStatus: true,
      hideText: true
    })
  },
  showPopup1() {
    let popupComponent = this.selectComponent('.J_Popup1');
    popupComponent && popupComponent.show();
    this.setData({
      showPop: true,
      hideText: false
    })
  },
  hidePopup1() {
    let popupComponent = this.selectComponent('.J_Popup1');
    popupComponent && popupComponent.toggle(false);
    // popupComponent && popupComponent.hide();
    this.setData({
      showModalStatus: false,
      dxStatus: false,
      timeStatus: true,
      xdStatus: true,
      ygStatus: true,
      addSbStatus: true,
      hideText: true
    })
  },
  popupTap1() {
    let popupComponent = this.selectComponent('.J_Popup1');

    popupComponent && popupComponent.toggle(false);
    this.setData({
      showModalStatus: false,
      dxStatus: false,
      timeStatus: true,
      xdStatus: true,
      ygStatus: true,
      addSbStatus: true,
      showPop: false,
      hideText: true
    })
  },
  popupTap(){
    let popupComponent = this.selectComponent('.J_Popup');

    popupComponent && popupComponent.toggle(false);
    this.setData({
      showModalStatus: false,
      dxStatus: false,
      timeStatus: true,
      xdStatus: true,
      ygStatus: true,
      addSbStatus: true,
      showPop: false,
      hideText: true
    })
  },

  wacthmore() {
    var animation = wx.createAnimation({
      duration: 200,
      timingFunction: "liner",
      delay: 0
    })
    if (!more) {
      more = true
      this.animation = animation
      this.setData({
        mores: "../image/low-up.png"
      })
      animation.height('auto').step()
    } else {
      more = false
      this.animation = animation
      this.setData({
        mores: "../image/low.png"
      })
      animation.height('50rpx').step()
    }

    this.setData({
      animationDatas: animation.export(),

    })
  },

  // 进度条
  addr() {
    var that = this
    that.setData({
      inde: 0
    })
  },
  shebei() {
    var that = this
    that.setData({
      inde: 1
    })
  },
  guzhang() {
    var that = this
    that.setData({
      inde: 2
    })
  },
  selectCoupon(e){
  var dis=e.currentTarget.dataset.dis
  var price=e.currentTarget.dataset.price
  var pp=dis==0?price:dis+"折"
    this.setData({
      couponIdex:e.currentTarget.dataset.index,
      couponsPrice:pp
    })
  },

  // 获取默认地址
  getDefaultAddr() {
    const that = this
    wx.request({
      url: url + '/address/default_address',
      method: "get",
      header: {
        "content-type": "application/json"
      },
      data: {
        usersTel: userTel
      },
      success(res) {
        console.log(res.data)
        if (res.data.code == 1) {
          address = res.data.data.address
          that.setData({
            address: res.data.data.address
          })
        } else if (res.data.code === 0) {

        } else {

        }
      }
    })
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function() {
    const that = this
    var addr = {}
    var user = wx.getStorageSync("user")
    console.log("onshow--userphone")
    console.log(user)
    userTel = user.wxUsersAccount
    that.getDates()
    var address1 = wx.getStorageSync("address")
    console.log("onshow")
    console.log(address)
    if (address1.addressDoorNumber != undefined) {
      address = address1
      that.setData({
        address:address1
      })
    } else {
      that.getDefaultAddr()
    }
    console.log("onshow-------时间")
    var eng = wx.getStorageSync("engneer", engineer)
    var time = wx.getStorageSync("time", time)
    console.log(eng.engineerId)
    if (eng.engineerId != undefined) {
      engineer = eng
      console.log("维修师等级:"+eng.engineerRank+"故障id:"+guzhangId)
      engineerRank = eng.engineerRank
      that.getPrice(eng.engineerRank, guzhangId)
      that.setData({
        selectsEng: eng.engineerName,
        selectsEngss:eng.rank.rankName,
        selectEngImg: eng.engineerImg,
        bgColor1: eng.rank.rankColor1,
        bgColor2: eng.rank.rankColor2,
      })
    }
    if (time) {
      date = time
      kstatus = 1
      that.setData({
        datess: time,
        timess: "",
        kstatus: 2,
        kuaisu: 2
      })
    }

  },
  // 选择日期
  selectDate(e) {
    const that = this
    data1 = e.currentTarget.dataset.dates
    console.log(e)
    that.setData({
      dateIndex: e.currentTarget.dataset.index,
      datess: e.currentTarget.dataset.week
    })
  },
  // 选择时间
  selectTime(e) {
    const that = this
    console.log(e)
    data2 = e.currentTarget.dataset.time
    that.setData({
      timeIndex: e.currentTarget.dataset.index,
      timess: e.currentTarget.dataset.time
      
    })
  },
  //确认时间
  timeconfig(e) {
    const that = this
    console.log(e)
    if (e.currentTarget.id == '0') {
      kstatus = 0
      that.setData({
        kstatus: 1,
        kuaisu: 1 //快速
      })
      
    } else {
      kstatus = 0
      that.setData({
        kstatus: 2,
        kuaisu: 1,
        selectsEng: "选择维修师"
        //预约
      })
    }
    date = data1 + data2

    that.popupTap()
  },
  getDates() {
    const that = this
    var time = datautil2.formatTime(new Date(), true);
    //获取一周的时间戳
    var toda = datautil1.getDates(5, time)
    console.log(toda)
    that.setData({
      datas: toda,
      currentDate: datautil2.formatTime(new Date(), false)
    })
  },
  back() {
    console.log("fanhui l ")
    wx.navigateBack(1)
  },
  //获取预估的价格
  getPrice(rank, id) {
    const that = this
    console.log("rank:"+rank)
    wx.request({
      url: url + '/menu/fault/price/fault_rank',
      data: {
        menuFaultId: id, //故障id
        rank: rank //师傅等级
      },
      method: "get",
      header: {
        "content-type": "application/json"
      },
      success(res) {
         console.log("预估价格")
        console.log(res.data)
        if (res.data.code === 1) {
          
          orderAmount = res.data.data.menuFaultPrice.menuFaultPriceUsers
          that.setData({
            prices: orderAmount
          })
        } else {
          //无数据

        }
      }
    })
  },
  selectAddr(){
    wx.navigateTo({
      url: "../equipment/equipment?page=myaddr&index=4&selectAddress=true"
    })
  },
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function() {

  }
})